速報APP / 工具 / Bluetooth arduino controller

Bluetooth arduino controller

價格:免費

更新日期:2017-06-16

檔案大小:2.4M

目前版本:1.0

版本需求:Android 4.1 以上版本

官方網站:mailto:mehdi.m.rouissat@gmail.com

Bluetooth arduino controller(圖1)-速報App

This app had been developed to allow you to control independently three electronic devices (LEDs) via Bluetooth.

LED1 ON sent “1” , LED1 OFF sent “0”

LED2 ON sent “3” , LED2 OFF sent “2”

LED3 ON sent “5” , LED3 OFF sent “4”

Arduino Code:

#define ledPin7 7

#define ledPin6 6

#define ledPin5 5

int state = 0;

void setup() {

pinMode(ledPin5, OUTPUT);

pinMode(ledPin6, OUTPUT);

pinMode(ledPin7, OUTPUT);

digitalWrite(ledPin5, LOW);

digitalWrite(ledPin6, LOW);

digitalWrite(ledPin7, LOW);

Serial.begin(38400); // Default communication rate of the Bluetooth module

}

void loop() {

if(Serial.available() > 0){ // Checks whether data is comming from the serial port

state = Serial.read(); // Reads the data from the serial port

}

if (state == '0') {

Bluetooth arduino controller(圖2)-速報App

digitalWrite(ledPin5, LOW); // Turn LED OFF

state = 0;

}

else if (state == '1') {

digitalWrite(ledPin5, HIGH); // Turn LED On

state = 0;

}

else if (state == '2') {

digitalWrite(ledPin6, LOW); // Turn LED OFF

state = 0;

}

else if (state == '3') {

digitalWrite(ledPin6, HIGH); // Turn LED On

state = 0;

}

else if (state == '4') {

digitalWrite(ledPin7, LOW); // Turn LED OFF

state = 0;

}

else if (state == '5') {

digitalWrite(ledPin7, HIGH); // Turn LED On

state = 0;

Bluetooth arduino controller(圖3)-速報App

}

}

Bluetooth arduino controller(圖4)-速報App